#include <cstdio>

#define MAX_RECTANGLES 11


struct Point
{
	double x, y;

	inline void readline () {
		scanf ("%lf %lf ", &x, &y);
	}
};


struct Rectangle
{
	double
		x_min, x_max,
		y_min, y_max;

	inline bool contains (const Point &p)
	{
		return
			x_min < p.x &&
			x_max > p.x &&
			y_min < p.y &&
			y_max > p.y;
	}

	inline void readline () {
		scanf (" %lf %lf %lf %lf ",
			&x_min,
			&y_max,
			&x_max,
			&y_min);
	}
};


int main ()
{
	Rectangle rectangle[MAX_RECTANGLES];
	Point point;
	char f;
	int p, r, i;
	bool contained;

	r = 1;
	while ((f = getchar ()) == 'r')
	{
		rectangle[r].readline ();
		++r;
	}

	p = 1;
	while (point.readline (), point.x != 9999.9 || point.y != 9999.9)
	{

		contained = false;
		for (i = 1; i < r; ++i)
		{
			if (rectangle[i].contains (point))
			{
				printf("Point %d is contained in figure %d\n", p, i);
				contained = true;
			}
		}
		if (!contained)
			printf("Point %d is not contained in any figure\n", p);
		++p;
	}

	return 0;
}